package cn.com.utt.unms.service;

import java.io.File;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import cn.com.utt.common.vo.RestResult;
import cn.com.utt.common.vo.TableInput;
import cn.com.utt.common.vo.TableOutput;
import cn.com.utt.unms.pojo.Device;
import cn.com.utt.unms.pojo.Wireless;
import cn.com.utt.unms.vo.DeviceInfo;
import cn.com.utt.unms.vo.GraphQueryResponse;
import cn.com.utt.unms.vo.SoftVersion;

@Service
public interface DeviceService {

	Device queryDeviceBySn(String sn);
	
	/**
	 * 
	 * @param input
	 *            表格相关参数
	 * @param userGroupId
	 *            当前彷管理的根分组groupId
	 * @return
	 */
	TableOutput<DeviceInfo> queryByCondition(TableInput input, long rootGroupId, boolean flag);

	Device queryDeviceById(long deviceid);

	List<Device> queryDeviceByIds(List<Long> deviceIds);

	List<Device> queryChildrenDevicesByGroupId(long groupId);

	Object queryHistoryByNetwork(long userId, long networkId, long start, long end, byte type, byte shape,int range);

	RestResult save(Device device);
	
	void batchSave(Map<String, Device> devices);

	Map<String, Object> remoteWebStatus(String sn,String host);

	Map<String, Object> remoteConnect(String sn,String webport,String host);

	RestResult isRightFormate(Device device);

	RestResult unbind(List<Device> devices);
	
	void switchFast(List<Device> devices, byte isFast);

	RestResult bingDevice(Device device);

	RestResult updateDeviceWireless(List<Device> devices, List<Wireless> wirelesses, boolean... flag);

	RestResult writeFileToDisk(MultipartFile file, String path);

	RestResult readExcelAndBindDevice(File file, long networkId, long rootGroupId, int type);

	RestResult batchUpdateSV(List<SoftVersion> svs, long userId, long groupId);

	boolean hasRights(List<Device> devices, long userGroupId);
	
	boolean hasRight(Device devices, long userGroupId);

	JSONObject general(Device device);

	List<GraphQueryResponse> visitorsRealTimeData(String sn,Timestamp bindtime, long start, long end);

	RestResult restart(Device device);

	RestResult reset(List<Device> devices);

	void reUp(String sn, int connect, int delay);

	List<GraphQueryResponse> packLoss(String sn, long start, long end);

	List<GraphQueryResponse> packError(String sn, long start, long end);

	List<Device> queryDevicesByNetworkIds(List<Long> networkIds);

	Map<String, Object> flowStatistics(long userId, Long networkId);
	
	RestResult update(Device device);
	
	JSONObject wirelessExpansion(Device device);
	
	JSONObject batchRfAndServiceZone(Device device);
	
	RestResult restarts(List<Device> devices);
}
